<template>

  <div class="dashboard-container">

    <h2>欢迎！   1803010146  周润君</h2>

    <div class="item">
      <h1>{{studentCount}}</h1>
      <h4>全校总人数</h4>
    </div>

    <div class="item">
    <h1>{{teacherCount}}</h1>
    <h4>教师总人数</h4>
  </div>

    <div class="item">
      <h1>{{academyCount}}</h1>
      <h4>学院总数</h4>
    </div>

    <div class="item">
      <h1>{{classsCount}}</h1>
      <h4>全校班级总数</h4>
    </div>
    
    <div class="item">
      <h1>{{schoolCount}}</h1>
      <h4>学校总数</h4>
    </div>

  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Dashboard',
  computed: {
    ...mapGetters([
      'name'
    ])
  },
  data(){
    return{
      studentCount:'',
      classsCount: '',
      teacherCount:'',
      academyCount:'',
      schoolCount:'',
    }
  },
  mounted() {
    this.$http.get('/api/student/count').then(res =>{
      this.studentCount = res
    })


    this.$http.get('/api/classs/count').then(res =>{
      this.classsCount = res
    })

    this.$http.get('/api/teacher/count').then(res =>{
      this.teacherCount = res
    })

    this.$http.get('/api/school/count').then(res =>{
      this.schoolCount = res
    })

    this.$http.get('/api/academy/count').then(res =>{
      this.academyCount = res       
    })
  }    
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}

.dashboard-container{
  display: flex;
}

  .item{
    text-align: center;
    transition: all 0.3s;
    position: relative;
    border-radius: 3px;
    top: 0;
    box-shadow: 0 0 0 0 rgba(0,0,0,0.1);
    padding: 10px;
    margin: 10px;
  }
  .item:hover{

    top: -20;
    box-shadow: 1px 10px 15px 2px rgba(0,0,0,0.1);
  }
</style>
